<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>复用</title>
</head>
<body>
<input type="text" id="first">
<input type="text" id="second">
<script>
    const elems = {
        length: 0,
        add: function (elem) {
            Array.prototype.push.call(this, elem);
        },
        gather: function (id) {
            this.add(document.getElementById(id));
        },
        find: function (callback) {
            return Array.prototype.find.call(this, callback);
        }
    };
    // elems.gather("first");
    // console.log(elems.length)
    // console.log(elems[0].nodeType)
    // elems.gather("second")
    // console.log(elems.length)
    // console.log(elems[1].nodeType)
    // console.log(elems)
    const first = document.getElementById("first");
    const second = document.getElementById("second");
    const map = {};
    map[first] = {data: 'firstElement'};
    map[second] = {data: 'secondElement'};
    console.log(first)
    console.log(map)
    console.log(map[first].data)
</script>
</body>
</html>